package dgut.haitaobao.service.impl;

import dgut.haitaobao.entry.CategoryVo;
import dgut.haitaobao.mapper.CategoryMapper;
import dgut.haitaobao.service.CategoryService;
import dgut.haitaobao.util.response.HttpResponse;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class CategoryServiceImpl implements CategoryService {
    @Resource
    private CategoryMapper categoryMapper;


    @Override
    public HttpResponse listCategories() {
        List<CategoryVo> categoryVos = categoryMapper.selectAllCategories();
        return HttpResponse.success(categoryVos);
    }

    @Override
    public HttpResponse getMaxSoldNumProducts() {
        return HttpResponse.success(categoryMapper.getMaxSoldNumProducts());
    }
}
